package xyz.second.ask_for_leave_manage_module.utils;

import xyz.second.ask_for_leave_manage_module.serivce.AskForLeaveManageService;
import xyz.second.ask_for_leave_manage_module.vo.AskForLeaveInfo;

/**
 * 提供一些会复用的，数据到数据结构间的转换函数
 * @author wjw
 */
public final class DataMapper {

    /**
     * AskForLeaveManageService中的data转换到vo的AskForLeaveInfo
     * @param data {@link AskForLeaveManageService.AskForLeaveRecordData}
     * @return {@link AskForLeaveInfo}
     */
    public static AskForLeaveInfo askDataToInfo(AskForLeaveManageService.AskForLeaveRecordData data) {
        return new AskForLeaveInfo(
            data.getId(), data.getAskAccount(), data.getAskUsername(), data.getAskStatus(),
            data.getAskTime(), data.getHandlerAccount(), data.getHandlerUsername(),
            data.getRejectReason(), data.getHandleTime(), data.getAskReason()
        );
    }

}
